package org.lanqiao.wxq.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.commons.dbutils.handlers.ScalarHandler;
import org.lanqiao.bean.Cascade;
import org.lanqiao.tools.BaseDao;
import org.lanqiao.wxq.dao.CascadeDao;

public class CascadeDaoImpl extends BaseDao implements CascadeDao {

	@Override
	public List<Cascade> selectCascadeAll() {
		try {
			return query.query("select * from `cascade`",new BeanListHandler<Cascade>(Cascade.class) );
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public List<Cascade> selectCascadeBypositionId(Integer positionId) {
		try {
			return query.query("select positionName from `cascade` where positionId=?",new BeanListHandler<Cascade>(Cascade.class),positionId);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
	}
	
	
	
	@Override
	public Integer insertCascade(Cascade info) {
		// TODO Auto-generated method stub
		return null;
	}

//	@Override 查询相应名称的id
	public Integer selectCidByName(String Cname) {
		try {
			return query.query("select id from `cascade` where positionName=? ", new ScalarHandler<Integer>(), Cname);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}


}
